This forum is closed to new posts and
responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:
Really appreciate your comments, although I managed to get it running a different way. Here's the code if it helps anyone else. The main thing I seemed to notice was that even though the result of the "execute" statement is set to "nothing" it still couldn't be part of the "while" process. As a result I copied the information into an array and processed that afterwards.
Sub Initialize()
On Error Goto handle_error
REM **************************************************
REM Define temporary variables
REM **************************************************
Dim vWebSession As New notessession
Dim vThisDatabase As notesdatabase
Dim vThisDocument As notesdocument
Dim newDoc As NotesDocument
Dim ses As New LCSession
Dim con As New LCConnection ("oledb")
Dim MyFldList As New LCFieldList
Dim MyFldList2 As New LCFieldList
Dim MyFld As LCField
Dim MyFld2 As LCField
Dim MyFld3 As LCField
Dim MyFld4 As LCField
Dim SQL As String
Dim MyResult As String
Dim count As Integer
Dim X As Integer
Dim Y As Integer
REM **************************************************
REM Initialize variables
REM **************************************************
Set vThisDatabase = vWebSession.CurrentDatabase
'Set vThisDocument = vWebSession.DocumentContext
ses.ClearStatus
'Set connection details
With con
.Provider = "SQLOLEDB"
.Server = "Server"
.Database = "Database"
.Metadata = "TableName"
.userid = "-----"
.password = "-----"
End With
On Error Resume Next
con.Connect
con.writeback = True
If Err = False Then
Else
Print "Connection failed with error " & Err & ": " & Error
Exit Sub
End If
REM **************************************************
REM Do stuff here
REM **************************************************
'Close session
con.Disconnect
Set myfldlist = Nothing
Set myfld = Nothing
Set con = Nothing
Set ses = Nothing
Exit Sub
REM **************************************************
REM Error Handler
REM **************************************************
handle_error:
Dim stat$, errcode As Long, msg$
If ses.Status <> LCSUCCESS Then
ses.Getstatus stat, errcode, msg
If (ses.Status = LCFAIL_EXTERNAL)Then
Print "ODBC message: " & msg & " code #" & Cstr(errcode), 0, _
"error number " & Err & " line " & Erl
Else
Print "Connector message: " & Text, 0, "error number " & _
Err & " line " & Erl
End If
Else
Print Error, 0, "error number " & Err & " line " & Erl
End If
Exit Sub
End Sub
Feedback response number WEBB8ADEWG created by ~Lisa Elreterobu on 10/19/2010